﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Configuration;
using System.Data.SqlClient;

namespace ScoreManage
{
    public partial class User1 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string item = Request.QueryString["Item"];
            if (!string.IsNullOrEmpty(item)) Menu1.Items[int.Parse(item) - 1].Selected = true;
            else Menu1.Items[0].Selected = true;
        }

        protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
        {
            if (Menu1.Items[0].Selected == true) {
                Response.Redirect("CourseManage.aspx?item=1");
            } else if (Menu1.Items[1].Selected == true){
                Response.Redirect("StudentManage.aspx?item=2");
            } else if (Menu1.Items[2].Selected == true)
            {
                Response.Redirect("TeacherManage.aspx?item=3");
            }
            else if (Menu1.Items[3].Selected == true)
            {
                Response.Redirect("GradeManage.aspx?item=4");
            }
            else if (Menu1.Items[4].Selected == true)
            {
                if (Session["UserType"].ToString() == "系统管理员")
                {
                    Response.Redirect("UserManage.aspx?item=5");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>alert('您不是系统管理员，无法操作！')</script>");
                }
            }
            else if (Menu1.Items[5].Selected == true)
            {
                Response.Redirect("GradeStatistic.aspx?item=6");
            }
            else if (Menu1.Items[6].Selected == true)
            {
                Response.Redirect("ChangePass.aspx?item=7");
            }
            else if (Menu1.Items[7].Selected == true)
            {
                Response.Redirect("UserChangeInfo.aspx?item=8");
            }
            else if (Menu1.Items[8].Selected == true)
            {
                Response.Redirect("Login.aspx?item=9");
            }
        }
    }
}